home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / langs / clisp-c.zoo / impnotes.txt < prev    next >
Encoding:
Text File  |  1993-06-05  |  44.1 KB  |  1,298 lines

  1.                 Implementation Notes for CLISP
  2.                 ==============================
  3.                 Last modified: 20 May 1993.
  4.  
  5. This implementation is mostly compatible to the standard reference
  6.  
  7.        Guy L. Steele Jr.: Common Lisp - The Language (1st ed.).
  8.        Digital Press 1984.
  9.        (CLtL1 for short)
  10.  
  11.  
  12. These notes document the differences of the CLISP implementation of Common
  13. Lisp to the standard CLtL1, and some implementation details.
  14.  
  15.  
  16.                       CHAPTER 1: Introduction
  17.                       -----------------------
  18.  
  19. No notes.
  20.  
  21.  
  22.                        CHAPTER 2: Data Types
  23.                        ---------------------
  24.  
  25. All the data types are implemented: numbers, characters, symbols, lists,
  26. arrays, hash tables, readtables, packages, pathnames, streams, random
  27. states, structures and functions.
  28.  
  29. 2.1.3.
  30. ------
  31.  
  32. There are four floating point types: short-float, single-float, double-float
  33. and long-float:
  34.                   sign    mantissa   exponent
  35.    short-float    1 bit   16+1 bits   8 bits
  36.    single-float   1 bit   23+1 bits   8 bits   CLISP uses IEEE format
  37.    double-float   1 bit   52+1 bits  11 bits   CLISP uses IEEE format
  38.    long-float     1 bit   >=64 bits  32 bits
  39.  
  40. The single and double float formats are those of the IEEE standard (1981),
  41. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  42. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  43.  
  44. Long floats have variable mantissa length, which is a multiple of 16 (or 32,
  45. depending on the word size of the processor). The default length used when
  46. long floats are read is given by the place (LONG-FLOAT-DIGITS). It can be
  47. set by (SETF (LONG-FLOAT-DIGITS) nnn), where nnn is a positive integer.
  48.  
  49. 2.1.4.
  50. ------
  51.  
  52. Complex numbers can have a real part and an imaginary part of different
  53. types. For example, (SQRT -9.0) evaluates to the number #C(0 3.0), which has
  54. a real part of exactly 0, not only 0.0 (which would mean "approximately 0").
  55. The type specifier for this is (COMPLEX INTEGER SINGLE-FLOAT), and
  56.  
  57.            (COMPLEX type-of-real-part type-of-imaginary-part)
  58.  
  59. in general.
  60. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  61.  
  62. 2.2.1.
  63. ------
  64.  
  65. The characters are ordered according to the ASCII encoding.
  66.  
  67. More precisely, CLISP uses the Atari character set:
  68.              $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F
  69.          $00 **             ** ** ** ** ** ** ** ** **      
  70.          $10                               ** **            
  71.          $20     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
  72.          $30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
  73.          $40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
  74.          $50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
  75.          $60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
  76.          $70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  
  77.          $80  Ç  ü  é  â  ä  à  å  ç  ê  ë  è  ï  î  ì  Ä  Å
  78.          $90  É  æ  Æ  ô  ö  ò  û  ù  ÿ  Ö  Ü  ¢  £  ¥  ß   
  79.          $A0  á  í  ó  ú  ñ  Ñ  ª  º  ¿     ¬  ½  ¼  ¡  «  »
  80.          $B0  ã  õ  Ø  ø        À  Ã  Õ  ¨  ´  +  ¶  ©  ®   
  81.          $C0                                                
  82.          $D0                                         §      
  83.          $E0                    µ                           
  84.          $F0     ±              ÷     °              ²  ³  ¯
  85. Here ** are control characters, not graphic characters. (The characters left
  86. blank here cannot be represented in this character set).
  87.  
  88. The following are standard characters:
  89.   #\Space               $20
  90.   #\Newline             $0A
  91. The following are semi-standard characters:
  92.   #\Backspace           $08
  93.   #\Tab                 $09
  94.   #\Linefeed            $0A
  95.   #\Page                $0C
  96.   #\Return              $0D
  97.   #\Rubout              $08
  98.  
  99. 2.2.2.
  100. ------
  101.  
  102. #\Newline is the delimiter between lines.
  103.  
  104. When writing to a file, #\Newline is converted to CR/LF. (This is the usual
  105. convention on ATARI, DOS and VMS.) For example, #\Return #\Newline is written
  106. as CR/CR/LF.
  107. When reading from a file, CR/LF is converted to #\Newline, and CR not
  108. followed by LF is read as #\Return.
  109.  
  110. 2.2.3.
  111. ------
  112.  
  113. There are the following additional characters with names:
  114.   #\Null                $00
  115.   #\Bell                $07
  116.   #\Escape              $1B
  117.  
  118. 2.2.4.
  119. ------
  120.  
  121. The code of a character is >=0, <256. CHAR-CODE-LIMIT = 256.
  122.  
  123. There are fonts 0 to 15, and CHAR-FONT-LIMIT = 16. But the system itself
  124. uses only font 0.
  125.  
  126. The following bits attributes are implemented: :CONTROL, :META, :SUPER,
  127. :HYPER. Therefore CHAR-BITS-LIMIT = 16.
  128. The system itself uses these bits only to mention special keys and
  129. Control/Alternate/Shift key status on return from
  130. (READ-CHAR *KEYBOARD-INPUT*).
  131.  
  132. 2.5.
  133. ----
  134.  
  135. The maximum rank (number of dimensions) of an array is 65535 on 16-bit
  136. processors, 4294967295 on 32-bit processors.
  137.  
  138. 2.13.
  139. -----
  140.  
  141. All the functions built by FUNCTION, COMPILE and the like are atoms. There
  142. are built-in functions written in C, compiled functions (both of type
  143. COMPILED-FUNCTION) and interpreted functions (of type FUNCTION).
  144. The possible function names (CLtL1 p. 59) are symbols and lambda expressions.
  145.  
  146. 2.14.
  147. -----
  148.  
  149. This is the list of objects whose external representation can not be
  150. meaningfully read in:
  151.   * all structures lacking a keyword constructor.
  152.   * all arrays except strings, if *PRINT-ARRAY* = NIL.
  153.   * #<SYSTEM-FUNCTION name>     built-in function written in C
  154.   * #<SPECIAL-FORM name>        special form handler
  155.   * #<COMPILED-CLOSURE name>    compiled function, if *PRINT-CLOSURE* = NIL
  156.   * #<CLOSURE name ...>         interpreted function
  157.   * #<FRAME-POINTER #x...>      pointer to a stack frame
  158.   * #<DISABLED POINTER>         frame pointer which has become invalid on
  159.                                 exit from the corresponding BLOCK or TAGBODY
  160.   * #<...-STREAM ...>           stream
  161.   * #<PACKAGE name>             package
  162.   * #<HASH-TABLE #x...>         hash table, if *PRINT-ARRAY* = NIL
  163.   * #<READTABLE #x...>          readtable
  164.   * #<UNBOUND>                  "value" of a symbol without value, "value"
  165.                                 of an unsupplied optional or keyword argument
  166.   * #<SPECIAL REFERENCE>        environment marker for variables declared
  167.                                 SPECIAL
  168.   * #<DOT>                      internal READ result for "."
  169.   * #<END OF FILE>              internal READ result, when the end of file
  170.                                 is reached
  171.   * #<READ-LABEL ...>           intermediate READ result for #n#
  172.   * #<ADDRESS #x...>            machine address, should not occur
  173.   * #<SYSTEM-POINTER #x...>     should not occur
  174.  
  175. 2.15.
  176. -----
  177.  
  178. The type NUMBER is the disjoint union of the types REAL and COMPLEX. (CLtL
  179. wording: "exhaustive partition")
  180. The type REAL is the disjoint union of the types RATIONAL and FLOAT.
  181. The type RATIONAL is the disjoint union of the types INTEGER and RATIO.
  182. The type INTEGER is the disjoint union of the types FIXNUM and BIGNUM.
  183. The type FLOAT is the disjoint union of the types SHORT-FLOAT, SINGLE-FLOAT,
  184. DOUBLE-FLOAT and LONG-FLOAT.
  185.  
  186.  
  187.                      CHAPTER 3: Scope and Extent
  188.                      ---------------------------
  189.  
  190. is implemented as described.
  191.  
  192.  
  193.                       CHAPTER 4: Type Specifiers
  194.                       --------------------------
  195.  
  196. 4.5.
  197. ----
  198.  
  199. The general form of the COMPLEX type specifier is
  200. (COMPLEX type-of-real-part type-of-imaginary-part).
  201. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  202.  
  203. 4.6.
  204. ----
  205.  
  206. The REAL type specifier (REAL low high) denotes the real numbers between low
  207. and high.
  208.  
  209. 4.7.
  210. ----
  211.  
  212. DEFTYPE lambda lists are subject to destructuring (nested lambda lists are
  213. allowed, as in DEFMACRO) and may contain a &WHOLE marker, but no
  214. &ENVIRONMENT marker.
  215.  
  216. 4.9.
  217. ----
  218.  
  219. The possible results of TYPE-OF are:
  220.  CONS
  221.  SYMBOL NULL
  222.  FIXNUM BIGNUM RATIO SHORT-FLOAT SINGLE-FLOAT DOUBLE-FLOAT LONG-FLOAT COMPLEX
  223.  CHARACTER
  224.  (ARRAY element-type dimensions), (SIMPLE-ARRAY element-type dimensions)
  225.  (VECTOR T size), (SIMPLE-VECTOR size)
  226.  (STRING size), (SIMPLE-STRING size)
  227.  (BIT-VECTOR size), (SIMPLE-BIT-VECTOR size)
  228.  FUNCTION COMPILED-FUNCTION
  229.  STREAM PACKAGE HASH-TABLE READTABLE PATHNAME RANDOM-STATE
  230.  BYTE LOAD-TIME-EVAL READ-LABEL FRAME-POINTER SYSTEM-INTERNAL
  231.  ADDRESS (should not occur)
  232.  any other symbol (structure types)
  233.  
  234.  
  235.                        CHAPTER 5: Program Structure
  236.                        ----------------------------
  237.  
  238. 5.1.3.
  239. ------
  240.  
  241. In addition to the 24 special forms listed on p. 57, the macros
  242. PSETQ, PROG1, PROG2, WHEN, UNLESS, COND, MULTIPLE-VALUE-LIST,
  243. MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ, AND, OR
  244. are implemented as special forms.
  245.  
  246. Constants may not be bound dynamically or lexically.
  247.  
  248. 5.2.2.
  249. ------
  250.  
  251. LAMBDA-LIST-KEYWORDS =
  252.     (&OPTIONAL &REST &KEY &ALLOW-OTHER-KEYS &AUX &BODY &WHOLE &ENVIRONMENT)
  253.  
  254. LAMBDA-PARAMETERS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  255. processors.
  256.  
  257. 5.3.
  258. ----
  259.  
  260. DEFUN and DEFMACRO are allowed in non-toplevel positions.
  261. As an example, consider the definition of GENSYM:
  262. (let ((gensym-prefix "G")
  263.       (gensym-count 1))
  264.   (defun gensym (&optional (x nil s))
  265.     (when s
  266.       (cond ((stringp x) (setq gensym-prefix x))
  267.             ((integerp x)
  268.              (if (minusp x)
  269.                (error "~S: index ~S is negative" 'gensym x)
  270.                (setq gensym-count x)
  271.             ))
  272.             (t (error "~S: argument ~S of wrong type" 'gensym x))
  273.     ) )
  274.     (prog1
  275.       (make-symbol
  276.         (concatenate 'string
  277.           gensym-prefix
  278.           (write-to-string gensym-count :base 10 :radix nil)
  279.       ) )
  280.       (incf gensym-count)
  281. ) )
  282.  
  283. 5.3.2.
  284. ------
  285.  
  286. (PROCLAIM '(SPECIAL var)) declarations may not be undone. The same holds
  287. for DEFVAR, DEFPARAMETER and DEFCONSTANT declarations.
  288.  
  289. It is an error if a DEFCONSTANT variable is bound at the moment the
  290. DEFCONSTANT is executed, but DEFCONSTANT does not check this.
  291.  
  292. Constants may not be bound dynamically or lexically.
  293.  
  294.  
  295.                       CHAPTER 6: Predicates
  296.                       ---------------------
  297.  
  298. 6.2.2.
  299. ------
  300.  
  301. REALP returns T is its argument is a real number, NIL otherwise.
  302.  
  303. COMPILED-FUNCTION-P returns T on built-in functions written in C, compiled
  304. functions and special form handlers. Therefore COMPILED-FUNCTION is not a
  305. subtype of FUNCTION.
  306.  
  307. 6.3.
  308. ----
  309.  
  310. EQ compares characters and fixnums as EQL does. No unnecessary copies are
  311. made of characters and numbers. Nevertheless, one should use EQL.
  312.  
  313. (let ((x y)) (eq x x)) always returns T, regardless of y.
  314.  
  315. 6.4.
  316. ----
  317.  
  318. AND and OR are implemented as special forms and, as such, rather efficient.
  319.  
  320.  
  321.                       CHAPTER 7: Control Structure
  322.                       ----------------------------
  323.  
  324. 7.1.1.
  325. ------
  326.  
  327. (FUNCTION symbol) returns the local function definition established by FLET
  328. or LABELS, if it exists, otherwise the global function definition.
  329.  
  330. (SPECIAL-FORM-P symbol) returns NIL or T. If it returns T, then
  331. (SYMBOL-FUNCTION symbol) returns the (useless) special form handler.
  332.  
  333. 7.1.2.
  334. ------
  335.  
  336. PSETQ is implemented as a special form and, as such, rather efficient.
  337.  
  338. 7.2.
  339. ----
  340.  
  341. (SETF (SYMBOL-FUNCTION symbol) object) requires object to be either a
  342. function, a SYMBOL-FUNCTION return value or a lambda expression. A lambda
  343. expression is thereby immediately converted to a function.
  344.  
  345. SETF also accepts places yielding multiple values.
  346.  
  347. Additional places:
  348.  
  349. * FUNCALL:
  350.   (SETF (FUNCALL #'symbol ...) object) and
  351.   (SETF (FUNCALL 'symbol ...) object)
  352.   are equivalent to (SETF (symbol ...) object).
  353.  
  354. * GET-DISPATCH-MACRO-CHARACTER:
  355.   (SETF (GET-DISPATCH-MACRO-CHARACTER ...) ...)
  356.   performs a SET-DISPATCH-MACRO-CHARACTER.
  357.  
  358. * LONG-FLOAT-DIGITS:
  359.   (SETF (LONG-FLOAT-DIGITS) digits) sets the default mantissa length of long
  360.   floats to digits bits.
  361.  
  362. * VALUES:
  363.   (SETF (VALUES place1 ... placek) form)
  364.   is approximately equivalent to
  365.      (MULTIPLE-VALUE-BIND (dummy1 ... dummyk) form
  366.        (SETF place1 dummy1 ... placek dummyk)
  367.        (VALUES dummy1 ... dummyk)
  368.      )
  369.   Example:
  370.     (SETF (VALUES A B) (VALUES B A)) interchanges the values of A and B.
  371.  
  372. * VALUES-LIST:
  373.   (SETF (VALUES-LIST list) form)  is equivalent to
  374.   (VALUES-LIST (SETF list (MULTIPLE-VALUE-LIST form)))
  375.  
  376. &KEY markers in DEFSETF lambda lists are supported, but the corresponding
  377. keywords must appear literally in the program text.
  378.  
  379. (GET-SETF-METHOD form &optional env) and
  380. (GET-SETF-METHOD-MULTIPLE-VALUE form &optional env)
  381. receives as optional argument the environment necessary for macro expansions.
  382. In DEFINE-SETF-METHOD lambda lists, one can specify &ENVIRONMENT and a
  383. variable, which will be bound to the environment. This environment should be
  384. passed to all calls of GET-SETF-METHOD and GET-SETF-METHOD-MULTIPLE-VALUE.
  385. If this is done, even local macros will be interpreted as places correctly.
  386.  
  387. 7.3.
  388. ----
  389.  
  390. CALL-ARGUMENTS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  391. processors.
  392.  
  393. 7.4.
  394. ----
  395.  
  396. PROG1 and PROG2 are implemented as special forms and, as such, rather
  397. efficient.
  398.  
  399. 7.5.
  400. ----
  401.  
  402. If using the optional package MACROS3:
  403.   The macros LETF and LETF* are like LET and LET*, resp., except that they
  404.   can bind places, even places with multiple values.
  405.   Example:
  406.   (LETF (((VALUES A B) form)) ...)
  407.     is equivalent to
  408.     (MULTIPLE-VALUE-BIND (A B) form ...)
  409.   (LETF (((FIRST L) 7)) ...)
  410.     is approximately equivalent to
  411.     (LET* ((#:G1 L) (#:G2 (FIRST #:G1)))
  412.       (UNWIND-PROTECT (PROGN (SETF (FIRST #:G1) 7) ...)
  413.                       (SETF (FIRST #:G1) #:G2)
  414.     ) )
  415.  
  416. 7.6.
  417. ----
  418.  
  419. WHEN, UNLESS, COND are implemented as special forms and, as such, rather
  420. efficient.
  421.  
  422. 7.8.4.
  423. ------
  424.  
  425. The function MAPCAP is like MAPCAN, except that it concatenates the
  426. resulting lists with APPEND instead of NCONC:
  427.   (MAPCAP fun x1 ... xn) == (apply #'append (mapcar fun x1 ... xn))
  428. (Actually a bit more efficient that this would be.)
  429.  
  430. The function MAPLAP is like MAPCON, except that it concatenates the
  431. resulting lists with APPEND instead of NCONC:
  432.   (MAPLAP fun x1 ... xn) = (apply #'append (maplist fun x1 ... xn))
  433. (Actually a bit more efficient that this would be.)
  434.  
  435. 7.9.1.
  436. ------
  437.  
  438. MULTIPLE-VALUES-LIMIT = 128
  439.  
  440. MULTIPLE-VALUE-LIST, MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ are
  441. implemented as special forms and, as such, rather efficient.
  442.  
  443. The macro NTH-VALUE:
  444. (NTH-VALUE n form) returns the (n+1)st value (n>=0) of form.
  445.  
  446.  
  447.                         CHAPTER 8: Macros
  448.                         -----------------
  449.  
  450. No notes.
  451.  
  452.  
  453.                      CHAPTER 9: Declarations
  454.                      -----------------------
  455.  
  456. 9.2.
  457. ----
  458.  
  459. The declarations (TYPE type var ...), (FTYPE type fun ...),
  460. (FUNCTION name arglist result-type), (OPTIMIZE (quality value) ...)
  461. are ignored by the interpreter and the compiler.
  462.  
  463. Additional declarations:
  464.  
  465. * The declaration (COMPILE) has the effect that the current form is compiled
  466.   prior to execution.
  467.   Examples:
  468.   (LOCALLY (DECLARE (COMPILE)) form)
  469.   executes a compiled version of form.
  470.   (let ((x 0))
  471.     (flet ((inc () (declare (compile)) (incf x))
  472.            (dec () (decf x)))
  473.       (values #'inc #'dec)
  474.   ) )
  475.   returns two functions. The first is compiled and increments x, the second
  476.   is interpreted (slower) and decrements the same x.
  477.  
  478. 9.3.
  479. ----
  480.  
  481. The type assertion (THE value-type form) enforces a type check in
  482. interpreted code. No type check is done in compiled code.
  483.  
  484. If using the optional package MACROS3:
  485. (ETHE value-type form) enforces a type check in both interpreted and
  486. compiled code.
  487.  
  488.  
  489.                          CHAPTER 10: Symbols
  490.                          -------------------
  491.  
  492. No notes.
  493.  
  494.  
  495.                          CHAPTER 11: Packages
  496.                          --------------------
  497.  
  498. 11.6.
  499. -----
  500.  
  501. The package SYSTEM has the nicknames "SYS" and, additionally, "COMPILER".
  502.  
  503. 11.8.
  504. -----
  505.  
  506. The function REQUIRE receives as optional argument either a pathname or a
  507. list of pathnames: files to be loaded if the required module is not already
  508. in memory.
  509.  
  510.  
  511.                            CHAPTER 12: Numbers
  512.                            -------------------
  513.  
  514. The single and double float formats are those of the IEEE standard (1981),
  515. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  516. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  517.  
  518. The default number of mantissa bits in long floats is given by the place
  519. (LONG-FLOAT-DIGITS).
  520. Example: (SETF (LONG-FLOAT-DIGITS) 3322) sets the default precision of long
  521. floats to 1000 decimal digits.
  522.  
  523. 12.1.
  524. -----
  525.  
  526. Complex numbers can have a real part and an imaginary part of different
  527. types. If the imaginary part is EQL to 0, the number is automatically
  528. converted to a real number. (Cf. CLtL1 p. 195)
  529. This has the advantage that  (let ((x (sqrt -9.0))) (* x x))
  530. - instead of evaluting to #C(-9.0 0.0), with x = #C(0.0 3.0) -
  531. evaluates to #C(-9.0 0) = -9.0, with x = #C(0 3.0).
  532.  
  533. Coercions on operations involving different types:
  534. The result of an arithmetic operation whose arguments are of different float
  535. types is rounded to the float format of the shortest (least precise) of the
  536. arguments.
  537.     rational -> long float -> double float -> single float -> short float
  538. (in contrast to CLtL1 p. 195!)
  539. Rationale:
  540.   See it mathematically. Add intervals:
  541.   {1.0 +/- 1e-8} + {1.0 +/- 1e-16} = {2.0 +/- 1e-8}
  542.   So, if we add 1.0s0 and 1.0d0, we should get 2.0s0.
  543. Shortly:
  544.   Do not suggest accuracy of a result by giving it a precision that is
  545.   greater than its accuracy.
  546. Example:
  547.   (- (+ 1.7 pi) pi)  should not return  1.700000726342836417234L0,
  548.   it should return 1.7f0 (or 1.700001f0 if there were rounding errors).
  549. Experience:
  550.   If in a computation using thousands of short floats, a long float (like pi)
  551.   happens to be used, the long precision should not propagate throughout all
  552.   the intermediate values. Otherwise, the long result would look precise,
  553.   but its accuracy is only that of a short float; furthermore much
  554.   computation time would be lost by calculating with long floats when only
  555.   short floats would be needed.
  556.  
  557. When rational numbers are to be converted to floats (due to FLOAT, COERCE,
  558. SQRT or a transcendental function), the result type is given by the variable
  559. *DEFAULT-FLOAT-FORMAT*.
  560.  
  561. 12.4.
  562. -----
  563.  
  564. (LCM), called without arguments, returns 1, which is the neutral element of
  565. composition with LCM.
  566.  
  567. (! n) returns the factorial of n, n a nonnegative integer.
  568.  
  569. (EXQUO x y) returns the quotient x/y of two integers x,y, and checks that it
  570. is an integer. (This is more efficient than /.)
  571.  
  572. 12.5.1.
  573. -------
  574.  
  575. (EXPT base exponent) is not very precise if exponent has large absolute
  576. value.
  577.  
  578. (LOG number base) signals an error if base = 1.
  579.  
  580. 12.5.2.
  581. -------
  582.  
  583. The value of PI is a long float with the precision given by
  584. (LONG-FLOAT-DIGITS). When this precision is changed, the value of PI is
  585. automatically recomputed. Therefore PI is a variable, not a constant.
  586.  
  587. 12.6.
  588. -----
  589.  
  590. FLOAT-RADIX always returns 2.
  591.  
  592. (FLOAT-DIGITS number digits) coerces `number' (a real number) to a floating
  593. point number with at least `digits' mantissa digits. The following holds:
  594.    (>= (FLOAT-DIGITS (FLOAT-DIGITS number digits)) digits)
  595.  
  596. 12.7.
  597. -----
  598.  
  599. BOOLE-CLR   =  0
  600. BOOLE-SET   = 15
  601. BOOLE-1     = 10
  602. BOOLE-2     = 12
  603. BOOLE-C1    =  5
  604. BOOLE-C2    =  3
  605. BOOLE-AND   =  8
  606. BOOLE-IOR   = 14
  607. BOOLE-XOR   =  6
  608. BOOLE-EQV   =  9
  609. BOOLE-NAND  =  7
  610. BOOLE-NOR   =  1
  611. BOOLE-ANDC1 =  4
  612. BOOLE-ANDC2 =  2
  613. BOOLE-ORC1  = 13
  614. BOOLE-ORC2  = 11
  615.  
  616. 12.10.
  617. ------
  618.  
  619. MOST-POSITIVE-FIXNUM = 2^24-1 = 16777215
  620. MOST-NEGATIVE-FIXNUM = -2^24 = -16777216
  621.  
  622. Together with PI, the other long float constants MOST-POSITIVE-LONG-FLOAT,
  623. LEAST-POSITIVE-LONG-FLOAT, LEAST-NEGATIVE-LONG-FLOAT,
  624. MOST-NEGATIVE-LONG-FLOAT, LONG-FLOAT-EPSILON, LONG-FLOAT-NEGATIVE-EPSILON
  625. are recomputed whenever (LONG-FLOAT-DIGITS) is changed. They are variables,
  626. not constants.
  627.  
  628.  
  629.                          CHAPTER 13: Characters
  630.                          ----------------------
  631.  
  632. See first above: 2.2.
  633.  
  634. 13.1.
  635. -----
  636.  
  637. CHAR-CODE-LIMIT = 256
  638. CHAR-FONT-LIMIT = 16
  639. CHAR-BITS-LIMIT = 16
  640.  
  641. 13.2.
  642. -----
  643.  
  644. String-chars are those characters with font = 0 and bits = 0.
  645.  
  646. The graphic characters have been described above.
  647.  
  648. The standard characters are #\Newline and those graphic characters with a
  649. code between 32 and 126 (inclusive).
  650.  
  651. The alphabetic characters are these string-chars:
  652.              ABCDEFGHIJKLMNOPQRSTUVWXYZ
  653.              abcdefghijklmnopqrstuvwxyz
  654. and the international alphabetic characters from the character set:
  655.              ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜßáíóúñѪºãõØøÀÃÕ etc.
  656.  
  657. The functions CHAR-EQUAL, CHAR-NOT-EQUAL, CHAR-LESSP, CHAR-GREATERP,
  658. CHAR-NOT-GREATERP, CHAR-NOT-LESSP ignore bits and font attributes of their
  659. arguments.
  660.  
  661. 13.4.
  662. -----
  663.  
  664. The string chars that are not graphic chars and the space character have
  665. names:
  666.   (code-char #x00) = #\Null
  667.   (code-char #x05) = #\Code5
  668.   (code-char #x06) = #\Code6
  669.   (code-char #x07) = #\Bell
  670.   (code-char #x08) = #\Backspace = #\Rubout
  671.   (code-char #x09) = #\Tab
  672.   (code-char #x0A) = #\Newline = #\Linefeed
  673.   (code-char #x0B) = #\Code11
  674.   (code-char #x0C) = #\Page
  675.   (code-char #x0D) = #\Return
  676.   (code-char #x1A) = #\Code26
  677.   (code-char #x1B) = #\Escape
  678.   (code-char #x20) = #\Space
  679.  
  680. 13.5.
  681. -----
  682.  
  683. CHAR-CONTROL-BIT = 1
  684. CHAR-META-BIT    = 2
  685. CHAR-SUPER-BIT   = 4
  686. CHAR-HYPER-BIT   = 8
  687.  
  688.  
  689.                          CHAPTER 14: Sequences
  690.                          ---------------------
  691.  
  692. 14.1.
  693. -----
  694.  
  695. The result of NREVERSE is always EQ to the argument. NREVERSE on a vector
  696. swaps pairs of elements. NREVERSE on a list swaps the first and the last
  697. element and reverses the list chaining between them.
  698.  
  699. 14.2.
  700. -----
  701.  
  702. For iteration through a sequence, a macro DOSEQ, analogous to DOLIST, may be
  703. used instead of MAP :
  704.   (doseq (var seqform [resultform]) {declaration}* {tag|statement}* )
  705.  
  706. 14.3.
  707. -----
  708.  
  709. REMOVE, REMOVE-IF, REMOVE-IF-NOT, REMOVE-DUPLICATES return their argument
  710. unchanged, if no element has to be removed.
  711.  
  712. DELETE, DELETE-IF, DELETE-IF-NOT, DELETE-DUPLICATES destructively modify
  713. their argument: If the argument is a list, the CDR parts are modified. If
  714. the argument is a vector with fill pointer, the fill pointer is lowered and
  715. the remaining elements are compacted below the new fill pointer.
  716.  
  717. 14.5.
  718. -----
  719.  
  720. SORT and STABLE-SORT have two additional keywords :START and :END :
  721.   (SORT sequence predicate &key :key :start :end)
  722.   (STABLE-SORT sequence predicate &key :key :start :end)
  723.  
  724. SORT and STABLE-SORT are identical. They implement the mergesort algorithm.
  725.  
  726.  
  727.                          CHAPTER 15: Lists
  728.                          -----------------
  729.  
  730. 15.4.
  731. -----
  732.  
  733. SUBLIS and NSUBLIS apply the :KEY argument to the nodes of the cons tree and
  734. not to the keys of the alist.
  735.  
  736.  
  737.                       CHAPTER 16: Hash Tables
  738.                       -----------------------
  739.  
  740. 16.1.
  741. -----
  742.  
  743. MAKE-HASH-TABLE has an additional keyword :INITIAL-CONTENTS :
  744.   (MAKE-HASH-TABLE &key :test :initial-contents :size :rehash-size
  745.                         :rehash-threshold)
  746. The :INITIAL-CONTENTS argument is an alist that is used to initialize the
  747. new hash table.
  748. The :REHASH-THRESHOLD argument is ignored.
  749.  
  750. For iteration through a hash table, a macro DOHASH, analogous to DOLIST, can
  751. be used instead of MAPHASH :
  752.   (dohash (key-var value-var hash-table-form [resultform])
  753.     {declaration}* {tag|statement}*
  754.   )
  755.  
  756.  
  757.                      CHAPTER 17: Arrays
  758.                      ------------------
  759.  
  760. 17.1.
  761. -----
  762.  
  763. ARRAY-RANK-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  764. processors.
  765.  
  766. ARRAY-DIMENSION-LIMIT  = 2^24 = 16777216
  767. ARRAY-TOTAL-SIZE-LIMIT = 2^24 = 16777216
  768.  
  769. 17.6.
  770. -----
  771.  
  772. An array to which another array is displaced should not be shrunk (using
  773. ADJUST-ARRAY) in such a way that the other array points into void space.
  774. This is not checked at the time ADJUST-ARRAY is called!
  775.  
  776.  
  777.                        CHAPTER 18: Strings
  778.                        -------------------
  779.  
  780. 18.2.
  781. -----
  782.  
  783. String comparison is based on the function CHAR<=. Therefore diphtongs do
  784. not obey the usual national rules. Example: "o" < "oe" < "z" < "ö".
  785.  
  786.  
  787.                         CHAPTER 19: Structures
  788.                         ----------------------
  789.  
  790. 19.5.
  791. -----
  792.  
  793. The :PRINT-FUNCTION option should contain a lambda expression
  794.   (lambda (structure stream depth) (declare (ignore depth)) ...)
  795. This lambda expression names a function whose task is to output the external
  796. representation of structure onto the stream. This may be done by outputting
  797. text onto the stream using WRITE-CHAR, WRITE-STRING, WRITE, PRIN1, PRINC,
  798. PRINT, PPRINT, FORMAT and the like. The following rules must be obeyed:
  799. * The value of *PRINT-ESCAPE* must be respected.
  800. * The value of *PRINT-PRETTY* should not and cannot be respected, since the
  801.   pretty-print mechanism is not accessible from outside.
  802. * The value of *PRINT-CIRCLE* need not to be respected. This is managed by
  803.   the system. (But the print-circle mechanism handles only those objects that
  804.   are (direct or indirect) components of structure.)
  805. * The value of *PRINT-LEVEL* is respected by
  806.   WRITE, PRIN1, PRINC, PRINT, PPRINT, FORMAT ~A, FORMAT ~S, FORMAT ~W and
  807.   FORMAT ~D,~B,~O,~X,~R,~F,~E,~G,~$ with not-numerical arguments.
  808.   Therefore the print-level mechanism works automatically if only these
  809.   functions are used for outputting objects and if they are not called on
  810.   objects with nesting level > 1. (The print-level mechanism does not
  811.   recognize how many parentheses you have output. It only counts how many
  812.   times it was called recursively.)
  813. * The value of *PRINT-LENGTH* must be respected, especially if you are
  814.   outputting an arbitrary number of components.
  815. * You need not bother about the values of *PRINT-BASE*, *PRINT-RADIX*,
  816.   *PRINT-CASE*, *PRINT-GENSYM*, *PRINT-ARRAY*, *PRINT-CLOSURE*.
  817.  
  818.  
  819.                        CHAPTER 20: The Evaluator
  820.                        -------------------------
  821.  
  822. As in Scheme, the Macro (THE-ENVIRONMENT) returns the current lexical
  823. environment. This works only in interpreted code and is not compilable!
  824.  
  825. (EVAL-ENV form [env]) evaluates a form in a given lexical environment, just
  826. if the form had been part of the program text that environment came from.
  827.  
  828.  
  829.                          CHAPTER 21: Streams
  830.                          -------------------
  831.  
  832. 21.1.
  833. -----
  834.  
  835. *TERMINAL-IO* is not the only stream that communicates directly with the
  836. user: During execution of the body of a (WITH-KEYBOARD . body) form,
  837. *KEYBOARD-INPUT* is the stream that reads the keystrokes from the keyboard.
  838. It returns every keystroke in detail, as character with the following bits:
  839.   HYPER        if a non-standard key. These are:
  840.                  function keys, cursor keypad, numeric keypad, Delete key.
  841.   CHAR-CODE    the Ascii code for standard keys,
  842.                for non-standard keys:
  843.                  F1 -> #\F1, ..., F9 -> #\F9, F10 -> #\F10,
  844.                  Help -> #\Help, Undo -> #\Undo,
  845.                  Insert -> #\Insert, Delete -> #\Delete,
  846.                  ClrHome -> #\Home,
  847.                  Arrow keys -> #\Up, #\Down, #\Left, #\Right.
  848.   SUPER        if pressed together with Shift key(s) and if the keystroke
  849.                would have been an other without Shift.
  850.   CONTROL      if pressed together with the Control key.
  851.   META         if pressed together with the Alternate key.
  852. This keyboard input is not echoed on the screen.
  853. During execution of a (WITH-KEYBOARD . body) form, no input from *TERMINAL-IO*
  854. or any synonymous stream should be requested.
  855. The stream *KEYBOARD-INPUT* is used by *TERMINAL-IO*.
  856.  
  857. The stream *PRINTER-OUTPUT* outputs characters to the printer. When the
  858. printer is not ready, it is waited for, upto a delay of *PRINTER-TIMEOUT*
  859. times 0.005 sec. (which defaults to 5 sec.).
  860. Use WITH-OUTPUT-TO-PRINTER preferrably, for portability.
  861.  
  862. 21.2.
  863. -----
  864.  
  865. The macro WITH-OUTPUT-TO-PRINTER
  866.        (with-output-to-printer (var) {declaration}* {form}*)
  867. binds the variable var to an output stream that sends its output to the
  868. printer.
  869.  
  870. 21.3.
  871. -----
  872.  
  873. CLOSE ignores its :ABORT argument.
  874.  
  875.  
  876.                      CHAPTER 22: Input/Output
  877.                      ------------------------
  878.  
  879. 22.1.2.
  880. -------
  881.  
  882. A "reserved token", i.e. a token that has potential number syntax but cannot
  883. be interpreted as a number, is interpreted as symbol when being read. (CLtL1
  884. p. 341)
  885.  
  886. When a token with package markers is read, then (CLtL1 p. 343/344) no
  887. checking is done whether the package part and the symbol-name part do not
  888. have number syntax. (What's the purpose of this check?) So we consider
  889. tokens like USER:: or :1 or LISP::4711 or 21:3 as symbols.
  890.  
  891. 22.1.3.
  892. -------
  893.  
  894. The backquote read macro also works when nested. Example:
  895.  (eval ``(,#'(lambda () ',a) ,#'(lambda () ',b)))
  896.  = (eval `(list #'(lambda () ',a) #'(lambda () ',b)))
  897.  = (eval (list 'list (list 'function (list 'lambda nil (list 'quote a)))
  898.                      (list 'function (list 'lambda nil (list 'quote b)))
  899.    )     )
  900.  
  901. 22.1.4.
  902. -------
  903.  
  904. #\ allows inputting characters of arbitrary code: #\Code231 yields the
  905. character (code-char 231.).
  906.  
  907. Additional read dispatch macros:
  908. * #Y is used to read compiled functions.
  909. * #" is used to read pathnames:
  910.      #"test.lsp" is the value of (pathname "test.lsp")
  911.      As in all strings, backslashes must be written twice here:
  912.      #"A:\\programs\\test.lsp"
  913.  
  914. 22.1.5.
  915. -------
  916.  
  917. Is it impossible to get the read macro function of a dispatch macro
  918. character like #\# using GET-MACRO-CHARACTER.
  919.  
  920. 22.1.6.
  921. -------
  922.  
  923. In absence of SYS::WRITE-FLOAT, floating point numbers are output in radix 2.
  924.  
  925. Pathnames are written according to the syntax #"namestring" if
  926. *PRINT-ESCAPE* /= NIL. If *PRINT-ESCAPE* = NIL, only the namestring is
  927. printed.
  928.  
  929. *PRINT-CASE* controls the output not only of symbols, but also of characters
  930. and some #<...> objects.
  931.  
  932. *PRINT-PRETTY* is initially = NIL.
  933.  
  934. *PRINT-ARRAY* is initially = T.
  935.  
  936. An additional variable *PRINT-CLOSURES* controls whether compiled and
  937. interpreted functions (closures) are output in detailed form. If
  938. *PRINT-CLOSURE* /= NIL, compiled closures are output in #Y syntax the reader
  939. understands. *PRINT-CLOSURE* is initially = NIL.
  940.  
  941. 22.3.1.
  942. -------
  943.  
  944. The functions WRITE and WRITE-TO-STRING have an additional keyword :CLOSURE
  945. that can be used to bind *PRINT-CLOSURE*.
  946.  
  947. 22.3.3.
  948. -------
  949.  
  950. The FORMAT option ~W is analogous to ~A and ~S, but avoids binding of
  951. *PRINT-ESCAPE*. (FORMAT stream "~W" object) is equivalent to
  952. (WRITE object :stream stream).
  953.  
  954. FORMAT ~R and FORMAT ~:R can output only integers in the range |n| < 10^66.
  955. The output is in English, according to the American conventions, and these
  956. conventions are identical to the British conventions only in the range
  957. |n| < 10^9.
  958.  
  959. FORMAT ~:@C does not output the character itself, only the instruction how
  960. to type the character.
  961.  
  962. FORMAT ~T can determine the current column of any stream.
  963.  
  964.  
  965.                     CHAPTER 23: File System Interface
  966.                     ---------------------------------
  967.  
  968. 23.1.
  969. -----
  970.  
  971. For most operations, pathnames denoting files and pathnames denoting
  972. directories can not be used interchangeably.
  973. This is especially important for the functions DIRECTORY, DIR, CD, MAKE-DIR,
  974. DELETE-DIR.
  975.  
  976. The minimum filename syntax that may be used portably is:
  977.   "xxx"       for a file with name xxx,
  978.   "xxx.yy"    for a file with name xxx and type yy,
  979.   ".yy"       for a pathname with type yy and no name specified.
  980. Hereby xxx denote 1 to 8 characters, and yy denote 1 to 3 characters, each of
  981. which being either alphanumerical or the underscore #\_.
  982. Other properties of pathname syntax vary between operating systems.
  983.  
  984. 23.1.1.
  985. -------
  986.  
  987. Pathname components:
  988. HOST          always NIL
  989. DEVICE        NIL or :WILD or "A"|...|"Z"
  990. DIRECTORY     (disknumber startpoint . subdirs) where
  991.                disknumber = NIL or the serial number of the diskette,
  992.                startpoint = :RELATIVE | :ABSOLUTE
  993.                subdirs = () | (subdir . subdirs)
  994.                subdir = :CURRENT (means ".") or
  995.                subdir = :PARENT (means "..") or
  996.                subdir = :WILD (means "...", all subdirectories) or
  997.                subdir = (name . type)
  998.                 name = :WILD or a simple string with 8 characters maximum
  999.                 type = :WILD or a simple string with 3 characters maximum
  1000. NAME          NIL or :WILD or a simple string with 8 characters maximum
  1001. TYPE          NIL or :WILD or a simple string with 3 characters maximum
  1002. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1003.  
  1004. When a pathname is to be fully specified (no wildcards), that means that
  1005. no :WILD is allowed, and NAME = NIL may not be allowed either.
  1006.  
  1007. External notation:  A123456:\sub1.typ\sub2.typ\name.typ
  1008. using defaults:             \sub1.typ\sub2.typ\name.typ
  1009. or                                             name.typ
  1010. or                        *:\sub1.typ\*.*\name.*
  1011. or similar.
  1012.  
  1013. 23.1.2.
  1014. -------
  1015.  
  1016. External notation of pathnames (cf. PARSE-NAMESTRING and NAMESTRING),
  1017. of course without spaces, [,],{,}:
  1018.  [ [drivespec]         a letter '*'|'A'|...|'Z'|'a'|...|'z'
  1019.    [Seriennummer]      an integer >=0, <2^24 in decimal notation
  1020.    :
  1021.  ]
  1022.  { name [. type] \ }   each one a subdirectory
  1023.  [ name [. type] ]     filename with type (extension)
  1024.  
  1025. Name and type may be character sequences of any length (consisting of
  1026. alphanumeric characters and '-', '_'). They are shortened to 8 resp. 3
  1027. characters and converted to upper case. A single '*' is allowed for :WILD.
  1028.  
  1029. NAMESTRING has an optional flag argument: (NAMESTRING pathname T) returns an
  1030. external notation suitable for GEMDOS.
  1031.  
  1032. The function USER-HOMEDIR-PATHNAME is not implemented.
  1033.  
  1034. 23.2.
  1035. -----
  1036.  
  1037. The file streams returned by OPEN are always buffered.
  1038.  
  1039. 23.3.
  1040. -----
  1041.  
  1042. FILE-AUTHOR always returns NIL.
  1043.  
  1044. FILE-POSITION works on any file stream. When a Newline is output to resp.
  1045. input from a file stream, its file position is increased by 2 since Newline
  1046. is encoded as CR/LF in the file.
  1047.  
  1048. 23.4.
  1049. -----
  1050.  
  1051. LOAD has two additional keywords :ECHO and :COMPILING.
  1052. (LOAD filename &key :verbose :print :echo :if-does-not-exist :compiling)
  1053. :VERBOSE T   causes LOAD to emit a short message that a file is being loaded.
  1054.              The default is *LOAD-VERBOSE*, which is initially = T.
  1055. :PRINT T     causes LOAD to print the value of each form.
  1056.              The default is *LOAD-PRINT*, which is initially = NIL.
  1057. :ECHO T      causes the input from the file to be echoed to *STANDARD-OUTPUT*
  1058.              (normally to the screen). Should there be an error in the file,
  1059.              you can see at one glance where it is.
  1060.              The default is *LOAD-ECHO*, which is initially = NIL.
  1061. :COMPILING T causes each form read to be compiled on the fly. The compiled
  1062.              code is executed at once and - in contrast to COMPILE-FILE -
  1063.              not written to a file.
  1064.  
  1065. The variable *LOAD-PATHS* contains a list of directories where program files
  1066. are searched - additionally to the specified or current directory - by LOAD,
  1067. REQUIRE, COMPILE-FILE.
  1068.  
  1069. 23.5.
  1070. -----
  1071.  
  1072. (DIRECTORY [pathname [:full]]) can run in two modes:
  1073. * If pathname contains no name or type component, a list of all matching
  1074.   directories is produced.
  1075. * Otherwise a list of all matching files is returned. If the :FULL argument
  1076.   is /= NIL, this contains additional information: for each matching file
  1077.   you get a list of at least four elements
  1078.   (file-pathname file-truename file-write-date-as-decoded-time file-length).
  1079.  
  1080. (DIR [pathname]) is like DIRECTORY, but displays the pathnames instead of
  1081. returning them. (DIR) shows the contents of the current directory.
  1082.  
  1083. (CD [pathname]) manages the current device and the current directory.
  1084. (CD pathname) sets it, (CD) returns it.
  1085. Note that this current directory is handled inside Lisp. When you call
  1086. programs, they will not know about this current directory. We don't modify
  1087. GEMDOS' current directory.
  1088.  
  1089. (DEFAULT-DIRECTORY) is equivalent to (CD), (SETF (DEFAULT-DIRECTORY) pathname)
  1090. is equivalent to (CD pathname).
  1091.  
  1092. (MAKE-DIR directory-pathname) creates a new subdirectory.
  1093.  
  1094. (DELETE-DIR directory-pathname) removes an (empty) subdirectory.
  1095.  
  1096. (EXECUTE programfile [args [space]])  executes an external program. Its name
  1097. is programfile. args is the string of arguments (also called "command tail")
  1098. and defaults to "". space is the amount of memory (in bytes) that is to be
  1099. placed at the program's disposal. The default for space is the bare minimum
  1100. the program may need, but this guess is often too low.
  1101.  
  1102. (SHELL [command])  calls the operating system's shell.
  1103. (SHELL) calls the shell for interactive use. (SHELL command) calls the shell
  1104. only for execution of the one given command.
  1105.  
  1106.  
  1107.                         CHAPTER 24: Errors
  1108.                         ------------------
  1109.  
  1110. 24.1.
  1111. -----
  1112.  
  1113. When an error occurred, you are in a break loop. You can evaluate forms as
  1114. usual. The HELP command (or help key if there is one) lists the available
  1115. debugging commands.
  1116.  
  1117.  
  1118.                   CHAPTER 25: Miscellaneous Features
  1119.                   ----------------------------------
  1120.  
  1121. 25.1.
  1122. -----
  1123.  
  1124. The compiler can be called not only by the functions COMPILE, COMPILE-FILE
  1125. and DISASSEMBLE, also by the declaration (COMPILE).
  1126.  
  1127. (COMPILE-FILE input-file [:output-file] [:listing] [:verbose] [:warnings])
  1128. compiles a file to bytecode.
  1129.     input-file                should be a pathname/string/symbol.
  1130. The :output-file argument     should be NIL or T or a pathname/string/symbol
  1131.                               or an output-stream. The default is T.
  1132. The :listing argument         should be NIL or T or a pathname/string/symbol
  1133.                               or an output-stream. The default is NIL.
  1134. The :warnings argument        specifies whether warnings should also appear
  1135.                               on the screen.
  1136. The :verbose argument         specifies whether error messages should also
  1137.                               appear on the screen.
  1138.  
  1139. The CLtL2 special form LOAD-TIME-VALUE is implemented. (LOAD-TIME-VALUE form)
  1140. is like (QUOTE #,form) except that the former can be generated by macros.
  1141.  
  1142. 25.2.
  1143. -----
  1144.  
  1145. No on-line documentation is available for the system functions (yet).
  1146.  
  1147. 25.3.
  1148. -----
  1149.  
  1150. (TRACE fun ...) makes the functions fun, ... traced. Syntax of fun:
  1151. Either a symbol:
  1152.        symbol
  1153. or a list of a symbol and some keywords and arguments (which must come in
  1154. pairs!):
  1155.        (symbol
  1156.          [:suppress-if form]   ; no trace output as long as form is true
  1157.          [:step-if form]       ; invokes the stepper as soon as form is true
  1158.          [:pre form]           ; evaluates form before calling the function
  1159.          [:post form]          ; evaluates form after return from the function
  1160.          [:pre-break-if form]  ; goes into the break loop before calling the
  1161.                                ; function if form is true
  1162.          [:post-break-if form] ; goes into the break loop after return from
  1163.                                ; the function if form is true
  1164.          [:pre-print form]     ; prints the values of form before calling the
  1165.                                ; function
  1166.          [:post-print form]    ; prints the values of form after return from
  1167.                                ; the function
  1168.          [:print form]         ; prints the values of form both before
  1169.                                ; calling and after return from the function
  1170.        )
  1171. In all these forms you can access
  1172.   the function itself               as *TRACE-FUNCTION*,
  1173.   the arguments to the function     as *TRACE-ARGS*,
  1174.   the function/macro call as form   as *TRACE-FORM*,
  1175. and after return from the function
  1176.   the list of return values from the function call  as *TRACE-VALUES*,
  1177. and you can leave the function call with specified values by using RETURN.
  1178.  
  1179. TRACE and UNTRACE are also applicable to macros, but not to locally defined
  1180. functions and macros.
  1181.  
  1182. The function INSPECT is not implemented.
  1183.  
  1184. The function ED calls the external editor specified by the variable *EDITOR*
  1185. (see config.lsp).
  1186. If using the optional package EDITOR:
  1187.   ED behaves like this only if the variable *USE-ED* is NIL.
  1188.   Otherwise ED uses an Emacs-like screen editor with multiple windows.
  1189.  
  1190. 25.4.1.
  1191. -------
  1192.  
  1193. The variable *DEFAULT-TIME-ZONE* contains the default time zone used by
  1194. ENCODE-UNIVERSAL-TIME and DECODE-UNIVERSAL-TIME. It is initially set to -1
  1195. (which means 1 hour east of Greenwich, i.e. Mid European Time).
  1196.  
  1197. The timezone in a decoded time must not necessarily be an integer, but (as
  1198. float or rational number) it should be a multiple of 1/4.
  1199.  
  1200. INTERNAL-TIME-UNITS-PER-SECOND = 200.
  1201.  
  1202. 25.4.2.
  1203. -------
  1204.  
  1205. The functions MACHINE-TYPE, MACHINE-VERSION, MACHINE-INSTANCE and
  1206. SHORT-SITE-NAME, LONG-SITE-NAME should be defined by every user in his
  1207. site-specific CONFIG.LSP file.
  1208.  
  1209. The variable *FEATURES* initially contains the symbols
  1210.    CLISP            ; this implementation
  1211.    COMMON-LISP
  1212.    CLTL1
  1213.    INTERPRETER
  1214.    COMPILER
  1215.    ATARI            ; if hardware = Atari ST/TT and operating system = TOS
  1216.    AMIGA            ; if hardware = Amiga and operating system = Exec/AmigaDOS
  1217.    DOS              ; if hardware = PC (clone)  and operating system = DOS
  1218.    OS/2             ; if hardware = PC (clone)  and operating system = OS/2
  1219.    PC386            ; if hardware = PC (clone) with a 386/486
  1220.    VMS              ; if hardware = VAX         and operating system = VMS
  1221.    UNIX             ; if                            operating system = Unix
  1222.                     ;                               (yes, in this case the
  1223.                     ;                               hardware is irrelevant!)
  1224.    language         ; same as the value of *LANGUAGE*
  1225.  
  1226. The constant *LANGUAGE* is a string containing the language in which the
  1227. system communicates with the user. A symbol of the same name is contained in
  1228. *FEATURES*. Possible values are (yet): ENGLISH, DEUTSCH, FRANCAIS.
  1229.  
  1230.  
  1231.                 CHAPTER 99: Platform specific Extensions
  1232.                 ----------------------------------------
  1233.  
  1234. 99.2. Random Screen Access
  1235. --------------------------
  1236.  
  1237. (SCREEN:MAKE-WINDOW)
  1238.   returns a "window stream". As long as this stream is open, the terminal
  1239.   is in cbreak/noecho mode. *TERMINAL-IO* shouldn't be used for input or
  1240.   output during this time. (Use WITH-KEYBOARD and *KEYBOARD-INPUT* instead.)
  1241.  
  1242. (SCREEN:WITH-WINDOW . body)
  1243.   binds SCREEN:*WINDOW* to a window stream and executes body. The stream is
  1244.   guaranteed to be closed when the body is left. During its execution,
  1245.   *TERMINAL-IO* shouldn't be used, as above.
  1246.  
  1247. (SCREEN:WINDOW-SIZE window-stream)
  1248.   returns the window's size, as two values:
  1249.   height (= Ymax+1) and width (= Xmax+1).
  1250.  
  1251. (SCREEN:WINDOW-CURSOR-POSITION window-stream)
  1252.   returns the position of the cursor in the window, as two values:
  1253.   line (>=0, <=Ymax, 0 means top), column (>=0, <=Xmax, 0 means left margin).
  1254.  
  1255. (SCREEN:SET-WINDOW-CURSOR-POSITION window-stream line column)
  1256.   sets the position of the cursor in the window.
  1257.  
  1258. (SCREEN:CLEAR-WINDOW window-stream)
  1259.   clears the window's contents and puts the cursor in the upper left corner.
  1260.  
  1261. (SCREEN:CLEAR-WINDOW-TO-EOT window-stream)
  1262.   clears the window's contents from the cursor position to the end of window.
  1263.  
  1264. (SCREEN:CLEAR-WINDOW-TO-EOL window-stream)
  1265.   clears the window's contents from the cursor position to the end of line.
  1266.  
  1267. (SCREEN:DELETE-WINDOW-LINE window-stream)
  1268.   removes the cursor's line, moves the lines below it up by one line and
  1269.   clears the window's last line.
  1270.  
  1271. (SCREEN:INSERT-WINDOW-LINE window-stream)
  1272.   inserts a line at the cursor's line, moving the lines below it down by
  1273.   one line.
  1274.  
  1275. (SCREEN:HIGHLIGHT-ON window-stream)
  1276.   switches highlighted output on.
  1277.  
  1278. (SCREEN:HIGHLIGHT-OFF window-stream)
  1279.   switches highlighted output off.
  1280.  
  1281. (SCREEN:WINDOW-CURSOR-ON window-stream)
  1282.   makes the cursor visible, a cursor block in most implementations.
  1283.  
  1284. (SCREEN:WINDOW-CURSOR-OFF window-stream)
  1285.   makes the cursor invisible, in implementations where this is possible.
  1286.  
  1287.  
  1288. Authors:
  1289. --------
  1290.  
  1291.         Bruno Haible                    Michael Stoll
  1292.         Augartenstraße 40               Gallierweg 39
  1293.     D - W 7500 Karlsruhe 1          D - W 5300 Bonn 1       until 30 June 1993
  1294.     D - 76137 Karlsruhe             D - 53117 Bonn          from 1 July 1993 on
  1295.         Germany                         Germany
  1296.  
  1297. Email:  haible@ma2s2.mathematik.uni-karlsruhe.de
  1298.